package cn.com.nes.mybatis.agent.ope.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;

/**
 * <p>
 * 寄存器和数据库模板绑定关系
 * </p>
 *
 * @author nes
 * @since 2023-04-18
 */
@TableName("register_template_map")
public class RegisterTemplateMap extends Model<RegisterTemplateMap> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 协议id
     */
    @TableField("protocol_id")
    private String protocolId;
    /**
     * 寄存器类型
     */
    @TableField("register_type")
    private String registerType;
    /**
     * 寄存器类型
     */
    @TableField("register_address")
    private Integer registerAddress;
    /**
     * 字内位地址
     */
    @TableField("bit_place")
    private Integer bitPlace;


    @TableField("bit_place_end")
    private Integer bitPlaceEnd;

    /**
     * 数据库字段
     */
    @TableField("field_name")
    private String fieldName;
    /**
     * 模板id
     */
    @TableField("template_id")
    private String templateId;

    @TableField(exist = false)
    private String bitAddress;


    public String getBitAddress() {
        return bitAddress;
    }

    public void setBitAddress(String bitAddress) {
        this.bitAddress = bitAddress;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProtocolId() {
        return protocolId;
    }

    public void setProtocolId(String protocolId) {
        this.protocolId = protocolId;
    }

    public String getRegisterType() {
        return registerType;
    }

    public void setRegisterType(String registerType) {
        this.registerType = registerType;
    }

    public Integer getRegisterAddress() {
        return registerAddress;
    }

    public void setRegisterAddress(Integer registerAddress) {
        this.registerAddress = registerAddress;
    }

    public Integer getBitPlace() {
        return bitPlace;
    }

    public void setBitPlace(Integer bitPlace) {
        this.bitPlace = bitPlace;
    }

    public Integer getBitPlaceEnd() {
        return bitPlaceEnd;
    }

    public void setBitPlaceEnd(Integer bitPlaceEnd) {
        this.bitPlaceEnd = bitPlaceEnd;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public static final String ID = "id";

    public static final String PROTOCOL_ID = "protocol_id";

    public static final String REGISTER_TYPE = "register_type";

    public static final String REGISTER_ADDRESS = "register_address";

    public static final String BIT_PLACE = "bit_place";

    public static final String FIELD_NAME = "field_name";

    public static final String TEMPLATE_ID = "template_id";

    @Override
    public Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "RegisterTemplateMap{" +
        ", id=" + id +
        ", protocolId=" + protocolId +
        ", registerType=" + registerType +
        ", registerAddress=" + registerAddress +
        ", bitPlace=" + bitPlace +
        ", fieldName=" + fieldName +
        ", templateId=" + templateId +
        "}";
    }
}
